‹#›
Inventor API 中的零件图、部件图和工程图
创建尺寸范例
' Get two edges from the model.
Dim oEdge1 As Edge
Dim oEdge2 As Edge
oEdge1 = oPartDef.SurfaceBodies.Item(1).Edges.Item(5)
oEdge2 = oPartDef.SurfaceBodies.Item(1).Edges.Item(11)
' Get the drawing curves that are associated with the edges.
' This will return Nothing if the edges aren't shown in the drawing.
Dim oCurves1 As DrawingCurvesEnumerator
Dim oCurves2 As DrawingCurvesEnumerator
oCurves1 = oView.DrawingCurves(oEdge1)
oCurves2 = oView.DrawingCurves(oEdge2)
' Create GeometryIntent objects for start/end points on the curves.
Dim oIntent1 As GeometryIntent
Dim oIntent2 As GeometryIntent
oIntent1 = osheet.CreateGeometryIntent(oCurves1.Item(1), PointIntentEnum.kEndPointIntent)
oIntent2 = osheet.CreateGeometryIntent(oCurves2.Item(1), PointIntentEnum.kStartPointIntent)
' Create a linear dimension
Dim oDim As LinearGeneralDimension
oDim = osheet.DrawingDimensions.GeneralDimensions.AddLinear(oTG.CreatePoint2d(8, 16), _
oIntent1, oIntent2, DimensionTypeEnum.kVerticalDimensionType)
' Create a GeometryIntent object that just defined the entity and no point.
Dim oIntent3 As GeometryIntent
oIntent3 = oSheet.CreateGeometryIntent(oCurves2.Item(1))
' Create a dimension to the single entity.
oDim = osheet.DrawingDimensions.GeneralDimensions.AddLinear(oTG.CreatePoint2d(15, 23), _
oIntent3, , DimensionTypeEnum.kHorizontalDimensionType)